#include <bits/stdc++.h>
using namespace std;
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
using ll = long long;
void solve()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(ll i=0;i<n;i++)
    {
        cin >> a[i];
    }
    map<ll, ll> mp;
    for (ll i = 0; i < n;i++)
    {
        if(mp[a[i]]==0)
        {
            mp[a[i]]++;
            cout<<a[i]<<" ";  
        }

    }
    for (ll i = 1; i <= n;i++)
    {
        if(mp[i]==0)
        {
            cout<<i<<" ";
        }
    }
    cout << endl;
}
int main()
{
    int t = 1;
    cin >> t;
    while(t--)
    {
        solve();
    }
   return 0;
}
